from pages.basePage3 import BasePage
from config.setting import host_port
# 元素定位层
class Elment_Owner_information_audit(BasePage):
    def __init__(self):
        BasePage.__init__(self)
        self.driver.get(f"http://{host_port}/SharedParkingPlace/property/index.html")
# 定位审核管理
    def elment_audit(self):
        return self.driver.find_element_by_xpath('//*[@id="sm"]/div/div[5]/div[1]/div[1]')

    # 定位业主信息审核
    def elment_owner_info_audit(self):
        return self.driver.find_element_by_id('_easyui_tree_10')

     # 定位表单
    def elment_biaodan(self):
        a = self.driver.find_element_by_xpath('//div[@id="testIframe"]/div[2]/div[2]/div/iframe')
        return a
#     定位业主信息
    def elment_info_audit(self):
        return self.driver.find_element_by_xpath('/html/body/div/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr/td[1]/div/input')
# 定位审核按钮
    def elment_audit_anniu(self):
        return self.driver.find_element_by_xpath('//*[@id="tb"]/a')
# 定位断言文本框
    def elment_assert(self):
       return self.driver.find_element_by_xpath('/html/body/div/div[2]/div[2]/div[2]/div[2]')


#操作层
class Option_Owner_information_audit(Elment_Owner_information_audit):
    def __init__(self):
        Elment_Owner_information_audit.__init__(self)
#     点击审核管理
    def click_audit(self):
        self.elment_audit().click()
# 点击业主信息审核
    def click_owner_info_audit(self):
        self.elment_owner_info_audit().click()
# 切换表单
    def get_biaodna(self):
        a=self.elment_biaodan()
        return self.driver.switch_to.frame(a)
# 勾选业主信息
    def click_owner_info(self):
        self.elment_info_audit().click()
# 点击一键审核
    def click_audit_anniu(self):
        self.elment_audit_anniu().click()
# 获取断言文本
    def assert_text(self):
        return self.elment_assert().text

#业务层
class Apply_Owner_info_audit(Option_Owner_information_audit):

    def __init__(self):
        Option_Owner_information_audit.__init__(self)
    def information_audit(self):
        self.click_audit()
        self.click_owner_info_audit()
        self.get_biaodna()
        self.click_owner_info()
        self.click_audit_anniu()
        b=self.assert_text()

        return b
